package com.IoLiu;

import java.io.*;
import java.util.ArrayList;

public class StuCo {
    public static void main(String[] args) throws IOException {
        ArrayList<Student> list=new ArrayList<Student>();
        Student s1=new Student("张三","heima001",22,"三四");
        Student s2=new Student("李四","heima002",23,"二四");
        Student s3=new Student("张三","heima003",24,"一四");
        Student s4=new Student("张三","heima004",25,"四四");
        Student s5=new Student("张三","heima005",26,"三三");
        Student s6=new Student("张三","heima006",27,"三二");
        Student s7=new Student("张三","heima007",28,"三一");
        Student s8=new Student("张三","heima008",29,"三五");
        list.add(s1);
        list.add(s2);
        list.add(s3);
        list.add(s4);
        list.add(s5);
        list.add(s6);
        list.add(s7);
        list.add(s8);
        BufferedWriter bw=new BufferedWriter(new
                FileWriter("D:\\下载\\file\\file1\\student.txt",true));
        for (Student student:list) {
            bw.write(student.append().toString());
            bw.newLine();
            bw.flush();
        }
        bw.close();;


    }
}
